﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnliQ.Service.Contracts;

namespace UnliQ.ServiceLayer
{
    public class UserService : IUserService
    {
        public Response<List<UserDTO>> GetAllUsers()
        {
            //Comment
            return new Response<List<UserDTO>>
            {
                IsSuccessful = true,
                ReturnModel = UnliQContext.Current.UsersRepo.GetList()
            };
        }


        public Response<bool> AddInitValues(List<UserDTO> initialUsers)
        {
            UnliQContext.Current.UsersRepo.AddInitUsers(initialUsers);
            return new Response<bool>
            {
                IsSuccessful = true,
                ReturnModel = true
            };
        }


        public Response<bool> UpdateUserRole(UserDTO user)
        {
            throw new NotImplementedException();
        }


        public Response<string> GetName(int userId)
        {           
            return new Response<string>
            {
                IsSuccessful = true,
                ReturnModel = UnliQContext.Current.UsersRepo.GetName(userId)
            };
        }


        public Response<int> GetId(string userName)
        {
            return new Response<int>
            {
                IsSuccessful = true,
                ReturnModel = UnliQContext.Current.UsersRepo.GetId(userName)
            };
        }


        public Response<List<string>> GetUsernames(List<int> userIds)
        {
            return new Response<List<string>>
            {
                IsSuccessful = true,
                ReturnModel = UnliQContext.Current.UsersRepo.GetUsernames(userIds)
            };
        }
    }
}
